package com.springboot.rabbitmq.work;

import lombok.SneakyThrows;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @Author: lzx
 * @Data: 2021/04/29/13:21
 * @Description：
 */
@Component
public class WorkCustomer {
    //一个消费者
    @RabbitListener(queuesToDeclare = @Queue("work"))
    public void receive1(String message) {
        System.out.println("message1: "+message);

    }
    //一个消费者
    @RabbitListener(queuesToDeclare = @Queue("work"))
    @SneakyThrows
    public void receive2(String message) {
        Thread.sleep(1000);
        System.out.println("message2: "+message);

    }

}
